package com.hllxd.hism.star.basic.service.controller2;

import com.hllxd.hism.star.basic.service.exception.BusinessException;
import com.hllxd.hism.star.basic.service.service.TechnologyService;
import com.hllxd.hism.framework.httprpc.service.*;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * author: xiyong.lxy
 * date: 2020-10-12 16:51
 */
@Slf4j
@RestGrpcService
@RestGrpcMapping("/v1/technology")
public class TechnologyController2 implements TechnologyService {

    @Data
    public static class Params {
        public Long groupID;
    }

    @Override
    @RestGrpcMapping("/list.do")
    public NTSTATUS list(PDRIVER_OBJECT params, PRESULT_OBJECT result) {
        log.info("request params: {}", params);
        try {
            Params aa = params.driverObject(Params.class);


            result.setData("success");

            return NTSTATUS.SUCCESS_STATUS();
        }catch (BusinessException e) {
            log.warn("Exception: {}. {}",e.toString(), params);
            return NTSTATUS.ERROR_STATUS(e.code, e.msg);
        }catch (Exception e) {
            log.error("Exception: {}. {}", e.toString(), params, e);
            return NTSTATUS.ERROR_STATUS("500", e.toString());
        }
    }
}
